//API进行统一管理
import requests from './request'
import mockRequests from './mockRequest'
//三级联动接口
//对外暴露函数，只要外部调用函数，就会向服务器发送请求获得数据
export const reqCategoryList = ()=> requests.get(`api/product/getBaseCategoryList`);
//获取banner  （home首页轮播图接口）
export const reqGetBannerList = ()=>mockRequests.get('/banner')
//获取floor数据
export const reqFloorList = ()=>mockRequests.get('/floor')
//获取搜索模块数据  地址： /api/list  请求方式：post   参数：需要带参数
//当前接口给服务器传递参数params，[至少是一个空对象]   reqGetSearchInfo({})
export const reqGetSearchInfo = (params)=> requests({url:"api/list",method:"post",data:params})
//获取产品详情的接口  //地址URL：/api/item/{skuid}    GET
export const reqGoodsInfo=(skuId)=>requests({url:`/api/item/${skuId}`,method:'get'});
//将产品添加到购物车，（获取更新某个产品的个数）
export const reqAddOrUpdateShopCart = (skuId,skuNum)=>requests({url:`/api/cart/addToCart/${skuId}/${skuNum}`,method:'post'})
//获取购物车列表数据接口 //URL：  /api/cart/cartList   method:GET
export const reqCartList = ()=>requests({url:`/api/cart/cartList`,method:'get'})
//删除购物车商品  //URL:/api/cart/deleteCart/{skuId}   method:DELETE
export const reqDeleteCartById = (skuId)=>requests({url:`/api/cart/deleteCart/${skuId}`,method:'delete'})
//修改商品选中的状态  URL：/api/cart/checkCart/{skuId}/{isChecked}  method:get
export const reqUpdateCheckedById = (skuId,isChecked)=>requests({url:`/api/cart/checkCart/${skuId}/${isChecked}`,method:'get'});
//获取验证码
export const reqGetCode = (phone)=>requests({url:`/api/user/passport/sendCode/${phone}`,method:'get'});
//注册  
export const reqUserRegister = (data)=>requests({url:'/api/user/passport/register',data,method:'post'});
//登录模块
export const reqUserLogin = (data)=>requests({url:'/api/user/passport/login',data,method:'post'});

//获取用户信息【需要带着用户的token向服务器索取信息】
export const reqUserInfo = ()=>requests({url:'/api/user/passport/auth/getUserInfo',method:'get'});

//退出登录
export const reqUserLogout = ()=>requests({url:'/api/user/passport/logout',method:'get'});

//获取用户地址信息
export const reqAddressInfo = ()=>requests({url:'/api/user/userAddress/auth/findUserAddressList',method:'get'});

//获取商品清单
export const reqAuthInfo = ()=>requests({url:'/api/order/auth/trade',method:'get'});

//提交订单的接口
export const reqSubmitOrder = (tradeNo,data)=>requests({url:`api/order/auth/submitOrder?tradeNo=${tradeNo}`,data,method:'post'});

//获取支付信息
export const reqPayInfo = (orderId)=>requests({url:`api/payment/weixin/createNative/${orderId}`,method:'get'});

//获取支付订单状态
export const reqPayStats = (orderId)=>requests({url:`api/payment/weixin/queryPayStatus/${orderId}`,method:'get'});

//个人中心订单列表
export const reqOrderList = (page,limit)=>requests({url:`api/order/auth/${page}/${limit}`,method:'get'});